#!/usr/bin/bash

. ${MUNIN_LIBDIR}/plugins/plugin.sh

NULLMAILER_QUEUE=${NULLMAILER_QUEUE:-'/var/spool/nullmailer/queue/'}

case ${1} in
	autoconf)
		echo 'yes'
		exit 0
		;;
	config)
		cat <<-EOF
		graph_category mail
		graph_title Nullmailer queue
		graph_vlabel mails
		mails.label number
		mails.min 0
		EOF
		exit 0
		;;
esac

echo "mails.value $(($(stat -c "%s" ${NULLMAILER_QUEUE}) - 2))"
